{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "6896875b-34ce-4fc5-809c-669c295067e7",
   "metadata": {},
   "source": [
    "# Jupyter Magic Example\n",
    "\n",
    "This small example shows how to use the Manim Slides cell (`%%manim_slides`) and line (`%manim_slides`) magics:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "a73f1c06-c7f8-4f19-a90e-e283bfb8c7c5",
   "metadata": {},
   "outputs": [],
   "source": [
    "from manim import *\n",
    "\n",
    "from manim_slides import *"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "68dda1a0-74ff-4d9e-9575-5b25a98f21e7",
   "metadata": {},
   "outputs": [],
   "source": [
    "%%manim_slides -v WARNING --progress_bar None MySlide --manim-slides controls=true\n",
    "\n",
    "config.media_embed = True\n",
    "\n",
    "class MySlide(Slide):\n",
    "    def construct(self):\n",
    "        square = Square()\n",
    "        circle = Circle()\n",
    "        \n",
    "        self.play(Create(square))\n",
    "        self.next_slide()\n",
    "        self.play(Transform(square, circle))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "54fa2d3e-bfee-417d-b64b-f3f30a8749ea",
   "metadata": {},
   "outputs": [],
   "source": [
    "class MyOtherSlide(Slide):\n",
    "    def construct(self):\n",
    "        text = VGroup(\n",
    "            Text(\"Press\"),\n",
    "            Text(\"and\"),\n",
    "            Text(\"loop\"),\n",
    "        ).arrange(DOWN, buff=1.0)\n",
    "\n",
    "        self.play(Write(text))\n",
    "        self.next_slide(loop=True)\n",
    "        self.play(Indicate(text[-1], scale_factor=2.0, run_time=0.5))\n",
    "        self.next_slide()\n",
    "        self.play(FadeOut(text))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "7d8ad450-1487-4ca7-8d89-bf8ac344e1fa",
   "metadata": {},
   "outputs": [],
   "source": [
    "%manim_slides -v WARNING --progress_bar None MyOtherSlide --manim-slides controls=true"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": ".venv",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
